package com.ximcontroller.models.elements.floor;

import java.util.Iterator;
import java.util.Vector;

import com.ximcontroller.models.elements.XIM;
import com.ximcontroller.models.elements.XIMSystem;

public class XIMFloor extends XIMSystem
{
	static final long serialVersionUID = 200911280044L;
	
	Vector<XIMFloorTile> tiles;
	
	public XIMFloor()
	{
		super();
		this.initialize();
	}
	
	public XIMFloor(XIM owner)
	{
		super(owner);
		
		this.initialize();
	}
	
	public void initialize()
	{
		this.tiles = new Vector<XIMFloorTile>();
		this.createTiles(64);
	}
	
	private void createTiles(int n)
	{	
		for (int i = 0; i < n; i++)
		{
			XIMFloorTile t = new XIMFloorTile();
			t.setOwner(this);
			t.setNumber(i+1);
			
			this.tiles.add(t);
		}
		
		this.notifyObservers();
	}
	
	public Iterator<XIMFloorTile> listTiles()
	{
		return (this.tiles.iterator());
	}
	
	public XIMFloorTile getTile(int number)
	{
		return (this.tiles.get(number));
	}
	
}
